package com.example.kotlin01

class PointKotlin(val x: Int, val y: Int) {
    //访问器1
    val isEqual1: Boolean
        get() {
            return x == y
        }
    //访问器2
    val isEqual2
        get() = x == y
    //访问器3
    var isEqual3 = false
        get() = x == y
        set(value) {
            field = value//类似于  isEqual3 = value
        }
}

fun main() {
    var pointKotlin = PointKotlin(3, 2)
    println("pointKotlin.isEqual1 is ${pointKotlin.isEqual1}")
    println("pointKotlin.isEqual2 is ${pointKotlin.isEqual2}")
    println("pointKotlin.isEqual3 is ${pointKotlin.isEqual3}")

}
